//#include "StdAfx.h"
#include "base_refrence_counter.h"

CBaseRefrenceCounter::CBaseRefrenceCounter(void)
{
	m_nRefrenceCount = 0;
}

CBaseRefrenceCounter::~CBaseRefrenceCounter(void)
{
}
int CBaseRefrenceCounter::AddRefrence()
{
	int nRef = 0;
	m_optex.Enter();
	nRef = ++m_nRefrenceCount;
	m_optex.Leave();
	return nRef;
}
int CBaseRefrenceCounter::ReleaseRefrence()
{
	int nRef = 0;
	m_optex.Enter();
	nRef = m_nRefrenceCount>0?(m_nRefrenceCount--):0;
	m_optex.Leave();
	return nRef;
}